Friend Class frmOptions
    Inherits System.Windows.Forms.Form

    Private WRDBImport As clsWRDBImport

    Friend Sub New(ByRef _WRDBImport As clsWRDBImport)
        Me.New()
        WRDBImport = _WRDBImport
        With WRDBImport
            With cboRCodes.Items
                .Clear()
                .Add("(None)")
                .AddRange(WRDBProject.DB.GetRecordList("ConvGrp", "ConvGroup").ToArray)
            End With
            With cboCulture.Items
                .Clear()
                .Add(String.Format("(Current: {0})", My.Application.Culture.Name))
                For Each c As System.Globalization.CultureInfo In System.Globalization.CultureInfo.GetCultures(Globalization.CultureTypes.AllCultures)
                    If c.Name.Trim <> "" Then .Add(c.Name)
                Next
            End With
        End With
    End Sub

    Private Sub btnInfo_Click(ByVal Sender As System.Object, ByVal eventArgs As System.EventArgs) Handles btnValidate.Click, btnRCodes.Click, btnBypass.Click, btnCulture.Click
        Dim s As String = ""
        If Sender Is btnValidate Then
            s = "This will compare imported values for Station ID, PCode, CCode, and RCode with values found in the appropriate Support tables. If not found, a warning will be issued and a new Support table entry will be made and you'll have to complete all other fields for the newly added records.\n\nIn addition, all imported numeric Values (i.e., values imported under PCode column headings or the 'Result' column heading) will be compared with allowable ranges in the PCodes support table. Warnings will be issued if out of range values are found.\n\nThis option will somewhat slow down the speed of import operations."
        ElseIf Sender Is btnRCodes Then
            s = "This option relates to the automatic conversion of RCodes upon import. If RCodes are being imported as a separate column, then the 'Conv Grp' header can be specified to read a specific named conversion group from that Support table. Conversion groups contain both 'convert from' and convert to' values and placed in named groups. You can specify similar 'on-the-fly' import conversions for any column.\n\nHowever, the above procedure only works if RCode is being imported from a separate column. If the RCode is 'embedded' in the numeric Result field (like '<1.23') and you want to do the RCode conversion, select the previously specified conversion group.\n\nThis option is likely to have relatively little impact upon import speed."
        ElseIf Sender Is btnBypass Then
            s = "If the import file is already in a tab-delimited text file with column headings and the data fields in the exactly correct order and data type, you can bypass all conversions and directly import the data into WRDB. Refer to the documentation about the required fields for each table. The type of table being imported will be discerned from the field names in the import table."
        ElseIf Sender Is btnCulture Then
            s = "In some instances the format of the imported data may differ from the format specified by your operating system associated with your culture setting. For example, if Windows is configured for use in France which formats dates like dd/MM/yyyy HH:mm and numbers like 1.234,56 but your import data is formatted for another culture (like the good ole USA), you can override the assumed culture-specific formats here."
        End If
        MsgBox(s.Replace("\n", vbCr), MsgBoxStyle.Information, CType(Sender, Button).Text.Replace("&", ""))
    End Sub

    Private Sub frmOptions_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        With WRDBImport
            chkValidate.Checked = .ValidateSupport
            If .RCodeConvGroup = "" Then cboRCodes.SelectedIndex = 0 Else cboRCodes.Text = .RCodeConvGroup
            '8/12/10: no longer available
            'chkBypass.Checked = .BypassImport
            If .CultureName.StartsWith("(") Then cboCulture.SelectedIndex = 0 Else cboCulture.Text = .CultureName
        End With
    End Sub
End Class